function $(id) {
	if(! id){
		return null;
	}
	if (id.tagName) {
		return id;
	}
	return document.getElementById(id);
}
var Event;
if (!Event) {
	Event = {};
}
Event.stop = function(e) {
	if (!e) {
		return;
	}
	if (e.stopPropagation) {
		e.stopPropagation();
	} else {
		e.cancelBubble = true;
	}
	if (e.preventDefault) {
		e.preventDefault();
	} else {
		e.returnValue = false;
	}
};
Event.addListener = function(target, eventType, handler) {
	var length = arguments.length;
	var params = new Array();
	for (var index = 3; index < length; index++) {
		params.push(arguments[index]);
	}

	var proxyHandler = function(event) {
		handler(event, params);
	}
	handler.proxyHandler = proxyHandler;

	if (document.attachEvent) {
		target.attachEvent("on" + eventType, proxyHandler);
	} else {
		if (document.addEventListener) {
			target.addEventListener(eventType, proxyHandler, false);
		} else {
			target["on" + eventType] = proxyHandler;
		}
	}
};
Event.target = function(event) {
	if (event.srcElement) {
		return event.srcElement;
	} else {
		return event.target;
	}
};
function paging(objURL,pageInfo){
	var p=$("pageInfoEl");
	var pageControlLinks = $("pageInfoEl").getElementsByTagName("A");
	var length = pageControlLinks.length;
	for(var index=0;index<length;index++){
   		Event.addListener(pageControlLinks[index],"click", goPage);
   	}
   	var pageNo = pageInfo.pageNo || 0;
    var pageSize = pageInfo.pageSize || 60;
    var totalCount = pageInfo.totalCount || 0;
    var totalPageNumber = pageInfo.pageCount;
   	if(pageNo == 0){
   		$("backPage").className = "disable";
   	}
   	if(pageNo == (totalPageNumber - 1) || pageInfo.pageCount == 0){
   		$("nextPage").className = "disable";
   	}    	
  	function goPage(event, params){    	
    	Event.stop(event);
    	var eventEl = Event.target(event);	    	
    	var action = Number(params[0]);
    	var pageA = Event.target(event).id;
    	if(pageA == "backPage"){
    		pageNo = (pageNo == 0? 0:pageNo-1);
    	}
    	if(pageA == "nextPage"){
    		pageNo = (pageNo == totalPageNumber-1? pageNo: pageNo+1);
    	}
    	if(pageA.indexOf("page") != -1){
    		pageNo = pageA.substring(4) - 1;
    	}
    	if(pageNo == pageInfo.pageNo || pageInfo.pageCount == 0){
    		return;
    	}	    	
   		var queryURL = objURL+"&pageSize="+pageInfo.pageSize+"&pageNo="+pageNo;
    	location.href = queryURL;	    	
   	}
}